package com.ss.jdk.funref;

import java.util.function.BiFunction;
import java.util.function.Function;

/**
 * @Auther: ljy.s
 * @Date: 2022/9/10 - 09 - 10 - 15:14
 */
public class FunctionRefTest05 {
    // 这是一个main方法，是程序的入口：
    public static void main(String[] args) {
        Function<String,Integer> function = (s) -> {
            return s.length();
        };
        System.out.println(function.apply("hello"));

        // 通过方法引用来实现
        Function<String, Integer> function1 = String::length;
        System.out.println(function1.apply("sss"));

        BiFunction<String, Integer, String> function2 = String::substring;
        String msg = function2.apply("Hello World", 3);
        System.out.println(msg);
    }
}
